import java.util.Arrays;

public class Text {
    public static void main(String[] args) {
        int[] arr1=new int[10];
        Arrays.fill(arr1,3);
        System.out.println(Arrays.toString(arr1));
    }
    public static void main9(String[] args) {
        int[] arr1={1,2,3,4};
        int[] arr2={1,2,3,4};
        int[] arr3={3,4,5,6};
        System.out.println(Arrays.equals(arr1,arr2));
        System.out.println(Arrays.equals(arr1,arr3));
    }
    public static void main8(String[] args) {
        int[] arr1={1,2,3,4};
        int[] copy=new int[arr1.length];
        System.arraycopy(arr1,1,copy,1,arr1.length-1);
        System.out.println(Arrays.toString(copy));

    }
    public static void main7(String[] args) {
        int[] arr1={2,3,4,5};
        int[] ret=Arrays.copyOf(arr1,arr1.length);
        System.out.println(Arrays.toString(ret));//这个也能对数组扩容
        int[] rat=Arrays.copyOf(arr1,arr1.length*2);                                            //int[] ret=Arrays.copyOf(arr1,arr1.length*2);
        System.out.println(Arrays.toString(rat));
    }
    public static String myArrayToString(int[] arr){
        String ret="[";
        for (int i = 0; i < arr.length; i++) {
            ret+=arr[i];
            if(i!=arr.length-1){
                ret+=",";
            }
        }
        ret+="]";
        return ret;
    }
    public static void main6(String[] args) {
        int[] arr1={1,2,3,4};
        String rac=myArrayToString(arr1);
        System.out.println(rac);
    }
    public static int[] fun3(){
        int[] tmp={1,2,3};
        return tmp;
    }

    public static void main5(String[] args) {
        int[] arr1=fun3();
        System.out.println(Arrays.toString(arr1));
    }
    public static void func(int[] array){
        array=new int[]{15,16,17};
    }
    public static void func1(int[] array){
        array[0]=100;
    }
    public static void main2(String[] args) {
        int[] array1={1,2,3,4};
        func(array1);
        System.out.println(Arrays.toString(array1));
        func1(array1);
        System.out.println(Arrays.toString(array1));
    }
    public static void main1(String[] args) {
        int[] arr1={1,2,3,4};
        int[] arr2=arr1;
        arr2[0]=100;
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2 ));

    }
}
